home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-07-12 | 9.7 KB | 242 lines | [TEXT/CWIE] |
- /*******************************************************************************\
- | |
- | CVersCaption ©1997 John C. Daub. All rights reserved |
- | |
- | John C. Daub <mailto:hsoi@eden.com> |
- | <http://www.eden.com/~hsoi/> <http://www.eden.com/~hsoi/prog.html> |
- | |
- \*******************************************************************************/
-
-
- DESCRIPTION
- ```````````
-
- A Metrowerks PowerPlant® inherited class that automatically displays an
- application version (e.g. in the About Box or something). All you have to
- do is make sure there is a 'vers' #1 resource in your application's resource
- fork, and then just make an instance of your object in some window/dialog
- (like while creating your 'PPob's in Constructor), (don't forget to register
- this class). It's pretty simple.
-
- Attempts to take advantage of advancements in PowerPlant (e.g. CTYP resources,
- elimination of CreateFromStream in favor of RegisterClass_(), etc) but also
- tries to maintain backwards compatability.
-
-
- USAGE
- `````
-
- Use of this class is fairly simple actually.
-
- Place the custom types into their proper location for Constructor to
- find them.
-
- Constructor Version | File to Use | Location to Place it
- ------------------------------------------------------------------------
- less than 2.4 CVersCaption.CPPb Same folder as Constructor app
-
- 2.4 or 2.4.1 CVersCaption.CTYP Same folder as Constructor app
-
- 2.4.2 or greater CVersCaption.CTYP "Custom Types" folder
-
- (Re)launch Constructor and the custom type will be visible in the Catalog
- window. Just drag an instance of the object into your PPob.
-
- Most of the property fields are the same as an LCaption. We add:
-
- Use string version - Uses the "shortVersion" of the VersRec, which is
- a Pascal-style string, if true. If false, the
- version information is extracted from the NumVersion
- of the VersRec.
-
- Print country code - If true, appends the countryCode (from the VersRec)
- to the end of the version string.
-
-
- Of course you don't need to use a PPob/LStream to create an object of this
- type; a parameterized constructor, copy constructor (and assignment
- operator) and of course default constructor are all provided for your
- convenience.
-
- Of course ensure CVersCaption.cp is in your project and that you register
- the class (if you do create it from an LStream).
-
- Finally, ensure you have a resource of type 'vers' and ID #1 in your
- project/application.
-
- That's it!
-
-
- CREDITS
- ```````
-
- This code was inspired by something I saw Robin Mair do in an
- example project of his (Eric Scouten had something very similar...dunno
- who did it first). Then a little coding help from Michael Trent
- in the "Tips & Tidbits" from MacTech Jan '97.
-
-
- DISCLAIMER
- ``````````
-
- This is NOT a product of Metrowerks Corporation. Please do NOT contact Metrowerks
- for help/support of this class/code. If you need support, please use the contact
- information given below.
-
-
- LICENSING AND USAGE AGREEMENT
- `````````````````````````````
-
- John C. Daub (author) grants you, and you accept, a nonexclusive, nontransferable
- license to distribute this code for you within your programs and projects. You may
- distribute this code in object code form only and only on magnetic diskettes,
- CD-ROM, or other media with your programs into which this code has been
- incorporated (if you need to distribute your program by some other medium, please
- contact the author). You agree that this license gives you no title nor rights
- of ownership in, of, and/or to this code, and acknowledge that this code
- is property of John C. Daub. This code is NOT in the public domain.
-
- Permission is granted to the following organizations to distribute this
- code on their CD-ROM collections:
-
- Pacific HiTech, Inc - Info-Mac CD-ROM
- Celestin Company - Apprentice CD
- Meterowerks Corporation - CodeWarrior
-
- If you and/or your organization wishes to distribute this code and are
- not explicitly listed above, please contact John C. Daub.
-
- You may modify the source code, compile it, and incorporate the resulting object
- code into your programs. If you modify the code, you cannot redistribute the
- modified code under the same class/code name. Furthermore, to prevent any
- problems and/or infringements, please contact the author prior to redistribution
- of any modified code.
-
- John C. Daub licenses this code to you on an "AS IS" basis. John C. Daub makes
- no warranties, neither expressed nor implied, regarding this code, its
- merchantability, nor its fitness for any purpose. John C. Daub agrees to make a
- reasonable effort to provide written or verbal corrections for any problems
- that might be found in this code.
-
- Use of this code must be credited in an appropriate manner and location (such
- as printed or online documentation and/or About boxes) with the following
- credit line:
-
- CVersCaption ©1997 John C. Daub. All rights reserved.
-
- If this license is too restrictive with the current law in your state or country,
- you should not use this code at all. Furthermore, if you personally find this
- agreement too restrictive or not to your satisfaction, you should not use this
- code at all.
-
-
- FUTURE
- ``````
-
- - Country codes are partially implimented..they're there, but it's not
- stellar. I know there have got to be more country codes out there than
- what was listed in ResEdit/Resorcerer. If you know of any missing, please
- let me know.
-
- Also, I would really prefer to use abbreviations for the country codes,
- like 2 character codes, e.g. "It" for Italy (or whatever the proper code
- is). If you know the proper abbreviations for these countries, please do
- let me know. Or if you know of a complete listing of this information, again
- do let me know.
-
- - Fix bugs, if any (hopefully not) :)
-
- - According to IM:Toolbox Essentials, 7-32, if an app doesn't contain
- a 'vers' #1, the Finder displays the string from the signature resource
- as version number. That might be a nice alternative to a missing 'vers' #1.
-
-
- CONTACT INFORMATION
- ```````````````````
-
- Even though you don't need to send me email or register or anything to
- use the code, it would still be nice to drop me a line and let me know
- what you think. If you find any bugs or add any cool features, send them
- to me so I can add it to the official distribution. Furthermore, if I
- have your contact information, I can notify you when new versions are
- released -- can be very handy if say there is a fatal crashing bug
- in the code or some such. So, it's probably in your own best interest
- to drop me a line :-)
-
- Also, be sure to visit my web site
-
- <http://www.eden.com/~hsoi/prog.html>
-
- and "register". I won't know if you're "registered" or not, but it's a nice
- way that you can be notified of product updates (e.g. I make a new
- version, post it on that page, if you're registered, you'll be emailed
- automatically that the page changed).
-
- John C. Daub
- <mailto:hsoi@eden.com>
- <http://www.eden.com/~hsoi/prog.html>
-
-
- CHANGE HISTORY
- ``````````````
-
- Date Vers Who Notes
- ----------------------------------------------------------------------------
- 01 Jan 97 1.0 JCD - Created file
-
- 20 Jan 97 1.1 JCD - fixed a bug (thanx to Wilfried Bernard) with
- extracting the pre-release number (nonRelRev).
-
- 21 Jan 97 1.2 JCD - added mUseShortString to allow the choice of
- using the VersRec.shortString, or the NumVersion.
- Modified the CPPb/CTYP to fit.
- - stored all the string literals in 'STR '
- resources for kinder localization. Class now
- requires the addition of "CVersCaption.rsrc" to one's
- project file.
- - created this seperate README to clean up the source
- file's appearance a bit.
- - added support to print the country codes, if desired.
- Not to a point where I want it, tho...lacking all the
- existing country codes, plus lacking the abbreviated
- versions of the countries. That looks better, IMHO.
-
- 26 Jan 97 1.2.1 JCD - added a little #ifdef to contend with DebugNew (if
- used)
-
- 19 Feb 97 1.2.2 JCD - updated the licensing information
- - minor tweaks and fixes
- - Added functionality so that if the pane is not active
- then the text is drawn dimmed. Required adding/overriding
- ActivateSelf, DeactivateSelf, DrawSelf.
-
- 14 May 97 1.3 JCD - Split custom types into seperate files for easier
- management.
- - Upgraded to CodeWarrior Professional 1
- - Updated demo application
- - Changed some throw macros to use more appropriate
- versions (e.g. ResFail instead of MemFail after GetString())
- - Updated licensing agreement
- - Cleaned up the sources to compile with no precompiled
- header file
- - Added assignment operator (rule of 3's, see C++ FAQs by
- Marshall Cline)
- - Cleaned up the source cosmetics to improve readability
- - Made DrawSelf protected, as it should be.
- - mText now initialized to nil before proceeding, where
- appropriate.
- - mVersion now Uint32 instead of Int32 (as per Types.h)
-
- 12 July 97 1.3.1 JCD - All ctor's use initialization lists instead of
- assignment (where possible).
- - All member data is now private (was protected). Appropriate
- accessor functions have been created (as public or
- protected, depending on context). Helps to further abstract
- the user away from the data (good C++ style).
- - Added include for PowerPlant_PCH to be consistant with
- PowerPlant sources.
- - Inline functions no longer defined within class declaration.
- Definitions moved outside of the class, but still in the header
- file. #pragma mark's added to source file to ease navigation
- and user indexing.
- - Added a "Usage" section to this README.